#define  _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
    char arr[100] = { 0 };
    char carr[100] = { 0 };

    scanf("%s",arr);
    printf("%s",arr);
        char* ph = arr;
        char* pt = arr;
        while (*pt)
        {
            pt++;
        }
        pt--;
        int i = 0;
        while (*pt != *ph)
        {
            while (*pt != ' ' && *pt != ph)
            {
                pt--;
            }
            char* cur = --pt;
            while (*pt != '\0' && *pt != ' ')
            {
                carr[i] = *pt;
                pt++;
                i++;
            }
            pt = cur;
            carr[i] = ' ';
        }
        carr[i] = '\0';
        printf("%s", carr);

    return 0;
}